package gererg;

/**
 * @author leon(liangzou0318@gmail.com)
 * @date 2012-11-22
 * @filaname CoinsChangeimpl.java
 */
public class CoinsChangeimpl {
    public static int makechanges(int money,int[] valuekinds){
    	int mincoins=money;
    	for(int i=0;i<valuekinds.length;i++){
    		if(money<valuekinds[i]){
    			continue;
    		}
    		else{
    		int temp=makechanges(money-valuekinds[i],valuekinds)+1;
    		if(mincoins>temp){
    			mincoins=temp;
    		}
    	}
    	}
		return mincoins;
    	
    }
	public static void main(String[] args) {
		int[] valuekinds=new int[]{25,21,10,15,1};
		int money=29;
		int a=makechanges(money,valuekinds);
		System.out.println(a);

	}

}
